﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace SW.Core
{
    public static class Config
    {
        private static string _TemplatePath;
        private static ConnectionConfig _Connection;
        private static SecurityConfig _Security;
        static Config()
        {
            Hashtable ht = ConfigurationManager.GetSection("StrongWorld") as Hashtable;
            _TemplatePath = ht["TemplatePath"].ToString();
            _Connection = new ConnectionConfig()
            {
                Type = ht["DbType"].ToString(),
                Host = ht["DbHost"].ToString(),
                Name = ht["DbName"].ToString(),
                User = ht["DbUser"].ToString(),
                Password = ht["DbPassword"].ToString()
            };
            _Security = new SecurityConfig()
            {
                Key = ht["SecurityKey"].ToString(),
                IV = ht["SecurityIV"].ToString(),
            };
        }

        public static string TemplatePath
        {
            get
            {
                return _TemplatePath;
            }
        }

        public static ConnectionConfig Connection
        {
            get
            {
                return _Connection;
            }
        }

        public static SecurityConfig Security
        {
            get
            {
                return _Security;
            }
        }
    }
}
